
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator




class LoginRequiredMixin(object):
    @method_decorator(login_required(login_url='/login/'))
    def dispatch(self, request, *args, **kwargs):
        return super(LoginRequiredMixin, self).dispatch(request, *args, **kwargs)

# def generate_verify_email_url(email):
#     """
#     :param user: 用户对象
#     :return:
#     """
#     # 1.加密的数据
#     data_dict = { "email": email}
#
#     # 2. 进行加密数据
#
#     from utils.secret import SecretOauth
#     secret_data = SecretOauth().dumps(data_dict)
#
#     # 3. 返回拼接url
#     active_url = settings.EMAIL_ACTIVE_URL + '?token=' + secret_data
#     return active_url